from selenium import webdriver
from selenium.webdriver.common.by import By
import time

# 打开浏览器,访问网址
driver = webdriver.Chrome()
driver.get('https://baidu.com')

# 添加需要登录的cookies
cookies = [{
    'name': 'BDUSS_BFESS',
    'value': 'djNmtpNW1XQVU2OE11NVRYUkh1ZzM2aEs2U0FSLURVQzdlaFdHZHhDRHJ0NnBpRVFBQUFBJCQAAAAAAAAAAAEAAABngzfNsK7QprLF1-7DwDY2NgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOsqg2LrKoNidm'
},
    {
        'name': 'BDUSS',
        'value': 'djNmtpNW1XQVU2OE11NVRYUkh1ZzM2aEs2U0FSLURVQzdlaFdHZHhDRHJ0NnBpRVFBQUFBJCQAAAAAAAAAAAEAAABngzfNsK7QprLF1-7DwDY2NgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOsqg2LrKoNidm'
    }]

for cookie in cookies:
    driver.add_cookie(cookie)

# 刷新浏览器
driver.refresh()

# 退出登录
time.sleep(3)
driver.quit()
